<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../header.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx }/webuploader/style.css">
<link rel="stylesheet" type="text/css" href="${ctx }/webuploader/webuploader.css">
<link rel="stylesheet" type="text/css" href="${ctx }/bootstrap/css/bootstrap-datetimepicker.css">
<!--引入JS-->
<script type="text/javascript" src="${ctx }/webuploader/webuploader.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx }/bootstrap/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx }/bootstrap/js/bootstrap-datetimepicker.fr.js"></script>
<script type="text/javascript" src="${ctx }/views/post/addpost.js"></script>
<meta charset="UTF-8" />
<style>
.user_temp{
	display: none;
	}
</style>
<div class="container">
<div class="panel panel-info">
   <ol class="breadcrumb">
  <li><a href="#">晒单</a></li>
  <li><a href="#" class="active">新增晒单</a></li>
</ol>
   <div class="panel-body">
      	<form id="defaultForm" class="form-horizontal" role="form" action="${ctx }/post/addPost" method="post">
      	<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">显示时间:</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" name="showtime" readonly 
							 id="datetimepicker" placeholder="设置定时显示日期" data-date-format="yyyy-mm-dd hh:ii:ss">
						</div>
						<div>
						</div>
						</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">标签:</label>
						<div class="col-sm-10">
							<select size="10" multiple class="form-control" name="label">
								<c:forEach var="bean" items="${labelList }">
										<option value="${bean.id }" >${bean.labelName }</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">发帖人：</label>
						<div class="col-sm-2">
						  <select class="form-control" id="usertype">
								<option value="0">网红</option>
								<option value="1">小号</option>
							</select>
						</div>
						<div class="col-sm-3 internet_red">
							<select class="form-control" name="user_red" id="user_red">
							<option value="">----选择下面网红----</option>
								<c:forEach var="user" items="${users_red }">
									<option value="${user.customerId }">${user.firstName }</option>
								</c:forEach>
							</select>
						</div>
						<div class="col-sm-3 user_temp">
							<select class="form-control" name="user_tmp" id="user_tmp">
							<option value="">----选择下面小号----</option>
								<c:forEach var="user" items="${users }">
									<option value="${user.customerId }">${user.firstName }</option>
								</c:forEach>
							</select>
						</div>
						
		</div>
					<div class="form-group">
						<label for="firstname" class="col-sm-2 control-label">帖子内容:</label>
						<div class="col-sm-10">
						    <textarea class="form-control" rows="8" name="description" id="description"></textarea>
						    <input type="hidden" class="form-control" name="key" id="key"/>
						    <input type="hidden" name="postType" value="1"/>
						</div>
					</div>
					 <div class="form-group">
						 <!--用来存放item-->
						<label for="firstname" class="col-sm-2 control-label"></label>
						<div class="col-sm-10">
						    <div id="fileList" class="uploader-list"></div>
						   <div id="filePicker">选择图片</div>
						</div>
					 </div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="submit" class="btn btn-info">发布</button>
							<!-- <button type="button" class="btn btn-default" id="back">返 回</button> -->
						</div>
					</div>
				</form>
   </div>
</div>
</div>
<script>
	$(function(){
		$('#datetimepicker').datetimepicker({
			format: 'yyyy-mm-dd hh:ii:ss',
			autoclose: true,
	        todayBtn: true,
	        pickerPosition: "bottom-left"
		});
	});
	
	$("#usertype").change(function(){
		if($("#usertype").val() == 1){
			$(".user_temp").show();
			$(".internet_red").hide();
			$("#user_red").val("");
		}else{
			$(".internet_red").show();
			$(".user_temp").hide();
			$("#user_tmp").val("");
		}
	});
</script>